require("dotenv").config();
const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = function (app) {
  app.use(
    createProxyMiddleware('/api', {
      target: `${process.env.APISERVER}/`,
      changeOrigin: true,
      pathRewrite: { '^/api': '' },
      // onProxyReq(proxyReq, req, res){
      //   req.headers['remote_addr'] = '183.17.228.186'
      // }
    },
    ),
  );
}
